<?php

	include_once '../controladores/ControladorElementos.php';

	if (!empty($_GET['usr']) && !empty($_GET['app']) && !empty($_GET['sec']) && !empty($_GET['elm'])){
			$usr = $_GET['usr'];
			$app = $_GET['app'];
			$secc = $_GET['sec'];
			$elm = $_GET['elm'];			
				
			$command = new ControladorElementos();
	
			$command->obtaintTextContentForUpdate($app,$secc,$elm);	
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>MetroGenerador - Editor de Texto</title>
<link href="../estilos/style_index.css" rel="stylesheet" type="text/css" media="screen" />
  <script src="../controladores/javascripts/dynamicContentFunctions.js?usr=<?php echo $usr;?>&app=<?php echo $app;?>&sec=<?php echo $secc;?>"> </script>
<script type="text/javascript" src="../controladores/javascripts/wysiwyg.js"> </script>
  <script src="../controladores/javascripts/jquery-1.9.1.js"></script>
  <script src="../controladores/javascripts/jquery-ui.js"></script>
  <script src="../controladores/javascripts/bootstrap.js"> </script>
</head>
<body onLoad="iFrameOn();">
<div id="header">
	<div id="logo"><img src="../imagenes/logo.png" alt="" width="335" height="53" /></div>
	<div id="menu">
		<ul> <li><a href="#" style="color:#FFF">Bienvenido: <?php
			 
				include_once '../controladores/ControladorUsuarios.php';
	
					$command = new ControladorUsuarios();
	
					echo $command->obtainUserName($usr);
			
			?></a>
                <ul> <li><a href="login.html" style="color:#FFF;"> > Cerrar Sesi&oacute;n</a></li></ul>
            </li>           
        </ul>

		<ul id="feed">
		  <li></li>
			<li></li>
		</ul>
	</div>
	
</div>
<!-- end header -->
<div id="wrapper">
	<!-- start page -->
	<div id="page">
		<div id="sidebar1" class="sidebar">
			 <ul>
		    <li>
              <h2>App: 	<?php  		include_once '../controladores/ControladorAplicaciones.php';
					$command = new ControladorAplicaciones();	
					echo $command->searchApplicationName($app);
				
				?>			  </h2><ul>
                    <li><form action="../generador/recieveDataApplication.php?user_id=<?php echo $usr;?>&app_id=<?php echo $app;?>" name="formGenerateApp" id="formGenerateApp" method="post" target="_blank"> <input type="image" src="../imagenes/generateAppSubmit.png" id="generateApp" name="generateApp"/> </form></li> </ul>
		    </li>
		    <li> <h2>Tus secciones</h2>			
			       <?php 
							include_once '../controladores/ControladorSecciones.php';
					$command = new ControladorSecciones();					
					echo $command->searchApplicationSections($app,$usr);
					?>               
             <li><input type="image" id="addSection" src="../imagenes/addSectionSubmit.png" alt="" width="127" height="22" onclick="addSectionTag();"/> </li>
                    <li>
                      <div id ="sectionInput"> </div>	
                    </li>
			  <li>
				  <h2>Opciones de aplicacion</h2>
				  <ul> <form action="" name="formEditApp" id="formEditApp" method="post">
                    <li><img src="../imagenes/delete_app.png" id="deleteApp" name="deleteApp" onClick="deleteApplication(<?php echo $app;?>)"/></li>
                   <li><a rel="popover" data-content='<?php 
				   
				   include_once '../config.inc.php';
				   
				   $command = new ControladorUsuarios();
				   $userEmail = $command->obtainUserEmail($usr);
				   
				   $command = new ControladorAplicaciones();	
				   $iconName = $command->searchImageIconApp($app);
				   				   
				   $appName = $command->searchApplicationName($app);
				   
				   $appDescription = $command->searchApplicationDescription($app);
				   
				   $appVersion = $command->searchApplicationVersion($app);
				   
				   $targetIconApp = ROUTE_APPLICATIONS_USERS.$userEmail."/Applications/".$appName."/images/".$iconName."";				
				   
				   
				      
				   echo '<form method="post" action="updateDataApp.php?usr='.$usr.'&app='.$app.'&sec='.$secc.'"><img class="thumb" src="'.$targetIconApp.'" /> <input type="image" src="../imagenes/updateAppData.png" /><br />';
				   echo ' <table width="200" border="0" align="center">
				        <tr>
				          <td colspan="2">&nbsp;</td>
			            </tr>
				        <tr>
				          <td colspan="2">- Nombre de la aplicaci&oacute;n:</td>
			            </tr>
				        <tr>
				          <td colspan="2"><input type="text" size="30" id="app_name" name="app_name" value ="'.$appName.'" style="float:left;
	font-family:Arial, Helvetica, sans-serif;
	font-size: 12px;
	padding:2px;
	border: 1px solid #999999;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	margin: 3px 5px 0px 0px;"/></td>
			            </tr>
				        <tr>
				          <td colspan="2">- Descripci&oacute;n</td>
			            </tr>
				        <tr>
				          <td colspan="2"><textarea id="app_description" name="app_description" style="
	float:left;
	font-family:Arial, Helvetica, sans-serif;
	font-size: 12px;
	width:165px;
	padding:10px;
	border: 1px solid #999999;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	margin: 3px 5px 0px 0px;" >'.$appDescription.'</textarea></td>
			            </tr>
				        <tr>
				          <td colspan="2">- Versi&oacute;n</td>
			            </tr>
				        <tr>
				          <td colspan="2"><input type="text" size="30" id="app_version" name="app_version" value="'.$appVersion.'" style="float:left;
	font-family:Arial, Helvetica, sans-serif;
	font-size: 12px;
	padding:2px;
	border: 1px solid #999999;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	margin: 3px 5px 0px 0px;"/></td>
			            </tr></table></form>';
					
	?>' data-placement="top" data-original-title="<?php 
				   
				   $command = new ControladorAplicaciones();	
				   $appName = $command->searchApplicationName($app);
				   echo $appName;
				   ?>"><img src="../imagenes/edit_app.png" id="editApp" name="editApp" /></a>

<script>
	   $('a[rel=popover]').popover({
      html: 'true',
      placement: 'top'
    })
</script></li>
                  </form></ul>
				</li>
			</ul>
		</div>
		<div id="content">
		  <div class="post">
		    <h1 class="title"><a href="#">Introduce el texto de tu agrado, para la seccion: - </a>		       <?php 							
			include_once '../controladores/ControladorSecciones.php';
					$command = new ControladorSecciones();					
					echo $command->searchSectionName($app,$secc); ?> -<br>
		      <img src="../imagenes/text_section_banner.png" width="665" height="133">
		    </h1>
		    <form action="text_element_update.php?usr=<?php echo $usr;?>&app=<?php echo $app;?>&sec=<?php echo $secc;?>&elm=<?php echo $elm;?>" name="formulario" id="formulario" method="post">
    </p><div id="wysiwyg_cp"  align="center" style="padding:8px; width:700px;"> <table width="649" border="0">
  <tr>
    <td colspan="5"> <p class="byline"><small>
	        Estilo de fuente</small></p></td>
                <td colspan="5"> <p class="byline"><small>
	        Estilo de p&aacute;rrafo</small></p></td>
            <td width="195" colspan="5"> <p class="byline"><small>
	        Insertar Elemento</small></p></td>
    </tr>
  <tr>
    <td width="31"><img src="../imagenes/b.png" width="31" height="27" onClick="iBold()"></td>
    <td width="31"><img src="../imagenes/i.png" width="31" height="27" onClick="iItalic()"></td>
    <td width="31"><img src="../imagenes/u.png" width="31" height="27" onClick="iUnderline()"></td>
    <td width="35"><img src="../imagenes/color.png" width="31" height="27" onClick="iForeColor()"></td>
    <td width="147"><select name="select" id="font_size" onChange="iFontSize()">
      <option value="0"> Tama&ntilde;o de fuente </option>
      <option value="1"> 1 </option>
      <option value="2"> 2 </option>
      <option value="3"> 3 </option>
      <option value="4"> 4 </option>
      <option value="5"> 5 </option>
      <option value="6"> 6 </option>
      <option value="7"> 7 </option>      
    </select></td>
    <td width="0">
    </td>
    <td width="16">&nbsp;</td>
    <td width="37"><img src="../imagenes/center.png" width="35" height="28" onClick="iJustifyCenter()"></td>
    <td width="43"><img src="../imagenes/justify.png" width="43" height="28" onClick="iJustify()"></td>
    <td width="37">&nbsp;</td>
    <td align="center"><p align="center"><img src="../imagenes/orderedList.png" width="31" height="27" onClick="iUnorderedList()"><img src="../imagenes/link.png" width="31" height="27" onClick="iLink()"><img src="../imagenes/image.png" width="31" height="27" onClick="iImage()"></p></td>
  </tr>
</table>
</div><textarea style="display:none;resize:none; margin-left: auto;
    margin-right: auto;" name="textarea" id="textarea" cols="160" rows="14"> </textarea> 
<iframe src="testIframe.html" name="textoAcomodado" id="textoAcomodado" style="border:#000000 1px solid; width:700px; height:400px;  float:right"> </iframe>

<br>
</p>
<p align="right"><input type="image" src="../imagenes/accept.png" name="boton" value="Aceptar" onclick="javascript:submit_form();" /></p>
<br></form>
		  </div>
</div>
		<!-- end content -->
		<!-- start sidebars -->
		
	</div>
	<!-- end page -->
</div>
<div align=center></div>
</body>
</html>